package yss.learn2develop.demoservice;

import android.app.IntentService;
import android.content.Intent;
import android.util.Log;

/**
 * Created by Administrator on 2014/7/28.
 */
public class YssIntentService extends IntentService {


    /**
     * Creates an IntentService.  Invoked by your subclass's constructor.
     *
     * @param name Used to name the worker thread, important only for debugging.
     */
    public YssIntentService(String name) {
        super(name);
    }

    public YssIntentService(){
        super("hello");
    }

    @Override
    protected void onHandleIntent(Intent intent) {
        Log.i("yss log","onHandleIntent");
        for (int i=0; i<200; i++)
        {
            try {
                Thread.sleep(1000);
                Log.i("yss log","Inttent Service:"+i);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }

        }
    }

    @Override
    public void onCreate() {
        Log.i("yss log","onCreate");
        super.onCreate();
    }

    @Override
    public void onStart(Intent intent, int startId) {
        Log.i("yss log","onStart");
        super.onStart(intent, startId);
    }

    @Override
    public void onDestroy() {
        Log.i("yss log","onDestroy");
        super.onDestroy();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        Log.i("yss log","onStartCommand");
        return super.onStartCommand(intent,flags,startId);
    }
}
